package com.poorstu.web.studentApply;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;

import com.common.base.web.BaseAction;
import com.poorstu.manager.BursaryManager;
import com.poorstu.manager.StudentManager;
import com.poorstu.model.BursaryMod;
import com.poorstu.model.LoginMod;

public class BursaryAddAction extends BaseAction {

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		try{
			int allUserId =(Integer)request.getSession().getAttribute("allUserId");
			DynaActionForm dyna=(DynaActionForm)form;
			String bursaryApplyer=dyna.getString("bursaryApplyer");
			BursaryManager bursaryManager=(BursaryManager)getBean("bursaryManager");
			//String error="error";
			//saveActionErrorMessage( request, error);
		int check=bursaryManager.addBursary(allUserId, bursaryApplyer);
			
		if(check==99)
		{  //提示平困生未通过审核不能申请助学经
			return mapping.findForward("repert");
		}
		
			return mapping.findForward("succ");
		}
		catch(Exception e){
			e.printStackTrace();
			return mapping.findForward("failure");
		}
	}
}
